package com.atguigu.srb.core.config;

import com.atguigu.srb.core.interceptor.UserStatusInterceptor;
import com.atguigu.srb.core.service.UserInfoService;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @Description:
 * @Author: Gavin
 * @Date: 7/15/2023 9:59 AM
 */
@Component
public class InterceptorConfigurer implements WebMvcConfigurer {
    @Resource
    UserInfoService userInfoService;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //注册创建好的拦截器
       registry.addInterceptor(new UserStatusInterceptor(userInfoService));
    }
}
